package _220310;

/**
 * @author ShadowLim
 * @create 2022-03-10-16:12
 */
public class _纸牌三角形 {
    static int[] arr = {1,2,3,4,5,6,7,8,9};
    static int res = 0;

    public static void main(String[] args) {
        f(0);
        System.out.println(res / 6); // 翻转（3） + 滤镜(2)
    }

    private static int f(int k) {
        if (k == 9) {
            int a = arr[0] + arr[1] + arr[3] + arr[5];
            int b = arr[0] + arr[2] + arr[4] + arr[8];
            int c = arr[5] + arr[6] + arr[7] + arr[8];
            if (a == b && b == c) {
                res++;
            }
        }
        for (int i = k; i < 9; i++) {
            int t = arr[k];
            arr[k] = arr[i];
            arr[i] = t;
            f(k + 1);
            t = arr[k];
            arr[k] = arr[i];
            arr[i] = t;
        }
        return res;
    }
}
